<html>
<head><meta charset="utf-8"><title>exact macro expansion · t-compiler/help · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/index.html">t-compiler/help</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/exact.20macro.20expansion.html">exact macro expansion</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="186622935"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/exact%20macro%20expansion/near/186622935" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Areredify <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/exact.20macro.20expansion.html#186622935">(Jan 26 2020 at 13:56)</a>:</h4>
<p>I am trying to check if a given expr is an exact expansion of a macro (that is, the macro expanded precisely to my expr). My approach right now is to compare outer ExpnId's of the expr and its parent. If they match, then the expansion is bigger than my expr. The problem is that a built-in macro (namely format_args) expansion has exprs whose outer expansion is not format_args (its the calling macro instead). Their parent node's outer expansion, on the other hand, is format_args, I compare them and get a false positive. Is there an easier way to achieve my goal that I am not aware of? If not, can you think of the way to fix my approach?</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>